package Test;

import junit.framework.Assert;

import org.junit.After;
import org.junit.Test;

import Command.Delete;
import Command.Insert;

public class TestInsert{
	
	@Test
	public void testExecuteQuery()
	{
		// TestCase 1
		Insert insCmd = new Insert("Insert      Into    NhanVien  values     (328, 'Nguyen D', 4)     ");
		insCmd.setDbName("DB_Test");
		Object actual1 = insCmd.executeQuery();		
		Assert.assertNotNull("TC 1", actual1);
		
		// TestCase 2
		insCmd.setSql("insert      into    NhanVien (TenNV, MaNV, Luong) values     ('Nguyen E', 329, 5)     ");
		Object actual2 = insCmd.executeQuery();
		Assert.assertNotNull("TC 2", actual2);
		
		// TestCase 3
		insCmd.setSql("insert      into    NhanVien (TenNV, MaNV) values     ('Nguyen F', 330)     ");
		Object actual3 = insCmd.executeQuery();
		Assert.assertNotNull("TC 3", actual3);
		
		// TestCase 3
		insCmd.setSql("insert      into    NhanVien (TenNV, MaNV) values     ('Nguyen G', 332)     ");
		Object actual4 = insCmd.executeQuery();
		Assert.assertNotNull("TC 4", actual4);
	}

	/*
	@After
	public void cleanTestExecuteQuery()
	{		
		Delete delCmd = new Delete("delete from NhanVien where MaNV >= 328");
		delCmd.setDbName("DB_Test");
		Object actual1 = delCmd.executeQuery();		
		Assert.assertEquals("TC 1,2,3 cleaner", "Delete 4 row(s) !" , actual1);		
	}
	*/

	
}
